<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="LoginUtil.User"
    import="persistent.Patient"
 %>
 
  <% User currentUser = (User) (session.getAttribute("currentSessionUser"));
 	/* if the current user is null or if he/she is not an Admin, Doctor, or Nurse */
 	if(currentUser == null || !(currentUser.getUserType() == User.UserType.Admin 
 							|| currentUser.getUserType() == User.UserType.Doctor 
 							|| currentUser.getUserType() == User.UserType.Nurse))
 	{
 		response.sendRedirect("login.jsp");
 	}
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
 	<%
 		Patient patient = (Patient)session.getAttribute("KEY_VIEWING_PATIENT");
 	%>
         <meta http-equiv="Content-Type" 
            content="text/html; charset=windows-1256">
         <title>   Viewing <%=patient.getFirstName()%> <%=patient.getLastName()%>   </title>
         <link rel="stylesheet" type="text/css" href="style.css" />
      </head>
<body>
	<center>
	<FORM NAME="userManagementForm" ACTION="userManagementServlet" METHOD="GET">
		<table cellpadding="3">
		<tr>
		<td>
			<TABLE cellpadding="5" border="1" style="foreground-color: #000000;">
			<tr>
			<th>Field</th>
			<th>Value</th>
			</tr>
			<tr><td>Name</td><td><%=patient.getFirstName()%> <%=patient.getLastName()%></td></tr>
			<tr><td>Age</td><td><%=patient.getAge() %></td></tr>
			<tr><td>Gender</td><td><%=patient.getGender() %></td></tr>
			<tr><td>Address</td><td><%=patient.getAddress() %></td></tr>
			<tr><td>Email</td><td><%=patient.getEmail() %></td></tr>
			<tr><td>Phone</td><td><%=patient.getNumber() %></td></tr>
			<tr><td>Insurance</td><td><%=patient.getInsurance() %></td></tr>
			<tr><td>Pharmacy</td><td><%=patient.getPharmacy() %></td></tr>
			<tr><td>Allergies</td><td><%=patient.getAllergies() %></td></tr>
			</TABLE>
		</td>
		</tr>
		<tr><td><button name="submitbutton" action="submit">View Health History</button></td></tr>
		<tr><td><a href="editPatient.jsp">Edit Patient Information</a></td></tr>
		<tr><td><a href="viewUserTreatmentRecord.jsp">View User's Treatment Records</a></td></tr>
		</table>
	</FORM>
	</center>
			
</body>
</html>